<?php 
/*
 * 		author GuoLong
 * 		2014/11/17
 * 		email:guolong@howdo.cc
 */


//test
class IndexController extends Controller {

	private $rootPath = "";		///var/www/html/howdo/
	private $targetPath = "common/upload/";
	private $uploadpath;
	public function __construct() {
		parent::__construct ();
		$this->view->web_host = $this->getRequest ()->hostUrl;
		$this->view->web_app_url = $this->getRequest ()->hostUrl . "/clientapi.php";
		$this->uploadpath=$this->rootPath.$this->targetPath;
	}
	//test
	public function Index(){
// 		$aData = new stdClass();
// 		$aData->user_name = "guolong";
// 		$aData->user_pwd = 123;
// 		$aData->captcha = "yesno";
// 		var_dump($aData);
// 		return;
// 		$msg="";
// // 		phpinfo();
		$this->view->display("index.htm");
	}
	public function uploadTest(){
		$image=$this->getRequest()->get("image");
		
		//加载上传类
		$this->getApp()->loadUtilClass("UploadtestUtil");
		//设置上传类的参数（参数为数组）
		$upPara=array(
				'allowType'=>array("jpg","jpeg","gif","png","bmp","*"),//图片格式另定
				'maxsize'=>"20000000",//大小限制20M
				'israndname'=>true,
				'filepath'=>$this->uploadpath."image/"
		);
		$up=new uploadutil($upPara);
		if($up->uploadFile("image")){
			echo "success!";
		}else{
			echo "failure!";
			echo $up->getErrorMsg();
		}
	}
	public function phpinfo(){
		phpinfo();
	}
}

